﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShoppingCartCommon.aspx.cs"
    Inherits="AS_ShoppingCartCommon" %>

<%@ Import Namespace="Shopping.Model" %>
<%@ Import Namespace="Shopping.Common" %>
<%
    if (_shoppingCart != null && _shoppingCart.Count > 0)
    {
        var tag = 1;
        var totalcount = 0;
        var totalprice = 0.0m;
        foreach (ShoppingCartInfo info in _shoppingCart)
        {
            totalcount += info.CartInfo.Quantity;
            totalprice += info.CartInfo.Price * info.CartInfo.Quantity;
            var goods = _goodsManage.GetGoods(info.CartInfo.GoodsID);
%>
<tr class="shoppingrow">
    <td class="goodname">
        <%=info.CartInfo.GoodsID %>
    </td>
    <td>
        <a href="/Goods/<%=info.CartInfo.GoodsID %>.html">
            <img src="<%=goods!=null && !string.IsNullOrEmpty(goods.MainPicture.SuperSmallPictureUrl)?goods.MainPicture.SuperSmallPictureUrl:""%>"
                style="border: 0px;" /></a>
    </td>
    <td class="discount">
        <a href="/Goods/<%=info.CartInfo.GoodsID %>.html" title="查看<%=info.GoodsName%>" target="_blank">
            <%=info.GoodsName%></a>
    </td>
    <td class="price">
        ￥<%=Utility.FormatMoneyStr(info.CartInfo.Price)%>
    </td>
    <td class="goodcount">
        <input name="txtQuantity" type="text" id="txtQuantity" value="<%=info.CartInfo.Quantity%>"
            onchange="ModifyQuantity();" size="5" maxlength="4" />
        <input name="txtprice" type="hidden" value="<%=info.CartInfo.Price %>" />
        <input name="hfGoodsID" type="hidden" id="hfGoodsID" value="<%=info.CartInfo.GoodsID %>" />
    </td>
    <td class="del">
        <a href="javascript:void(0);" class="delop" tag="<%=info.CartInfo.GoodsID %>" title="从购物车移除该商品">
            删除</a>
    </td>
</tr>
<%
                
tag += 1;
        }
%>
<tr>
    <td colspan="6" align="right">
        共采购商品<span class="totalcount"><%=totalcount %></span>件 ，总金额￥<span class="totalprice"><%=Utility.FormatMoneyStr(totalprice)%></span>
    </td>
</tr>
<%
    }
    else
    {
        Response.Write("<td class='goodcount' colspan='6'>购物车中还没有任何商品，去<a href='/index.aspx'>  挑选商品  </a></td>");
    } %>
